package com.siwei.mes.entity.system;

import cn.dev33.satoken.stp.StpUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;


/**
 * 预警表(Warning)实体类
 *
 * @author dmwang
 * @since 2024-07-18 09:51:52
 */
@Data
@Accessors(chain = true)
@Table(name = "pk_warning")
@ApiModel(value = "Warning", description = "预警表")
public class Warning implements Serializable {
    private static final long serialVersionUID = 297284677474643827L;
    @Id
    @ApiModelProperty(value = "预警表主键ID", name = "id")
    private Long id;
    /**
     * 预警code
     */
    @Column(name = "warning_code")
    @ApiModelProperty(value = "预警code", name = "warningCode")
    private String warningCode;
    /**
     * 预警名称
     */
    @Column(name = "waring_name")
    @ApiModelProperty(value = "预警名称", name = "waringName")
    private String waringName;
    /**
     * 预警时间（单位天）
     */
    @Column(name = "warning_time")
    @ApiModelProperty(value = "预警时间（单位天）", name = "warningTime")
    private Integer warningTime;
    /**
     * 状态  1-正常 0-禁用
     */
    @Column(name = "status")
    @ApiModelProperty(value = "状态  1-正常 0-禁用", name = "status")
    private Integer status;
    /**
     * 创建人
     */
    @Column(name = "creater")
    @ApiModelProperty(value = "创建人", name = "creater")
    private Long creater;
    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间", name = "createTime")
    private Date createTime;
    /**
     * 修改人
     */
    @Column(name = "updater")
    @ApiModelProperty(value = "修改人", name = "updater")
    private Long updater;
    /**
     * 更新时间
     */
    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间", name = "updateTime")
    private Date updateTime;
    /**
     * 是否删除  1-删除
     */
    @Column(name = "is_del")
    @ApiModelProperty(value = "是否删除  1-删除", name = "isDel")
    private Integer isDel;


    public Warning init() {
        this.setUpdater(StpUtil.isLogin() ? StpUtil.getLoginIdAsLong() : null)
                .setUpdateTime(new Date());
        return this;
    }
}
